<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        /**
         * 箭头函数，语法：（参数） => 表达式
         */
        // 示例1
        // var a = function(x){
        //     return x*2
        // };

        // var a = x => x*2;
        // console.log(a(4));

        // 示例2
        // var a = function(x,y){
        //     return x+y
        // }

        // var a = (x,y) => x+y;

        var a = (x,y) => {
            console.log(x);
            console.log(y);
            var sum = x + y;
            return sum;
        };


        var arr = [12,4,675,34,8]

        arr.sort((a,b) => b-a)

        arr.forEach((value,index) => {
            console.log(index,value);
        })

        console.log(arr);


        window.onclick = () => { // 匿名函数，一般用于回调
            console.log(1111);
        };


    </script>
</head>
<body>

</body>
</html>